<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <common-head></common-head>
  </div>
  <script src="./vue.js"></script>
  <script>
    const Logo = {
      template:`
        <div>
          <h2>logo组件</h2>
          {{ msg }}
        </div>
      `,
      data(){
        return {
          msg: 'logo组件中的数据'
        }
      }
    }
    const CommonHead = {
      template: `
        <div>
          <h1>我是公共头部</h1>  
          {{ msg }}
          <button @click="changeMsg">按钮</button>
          
          <logo></logo>
        </div>
        
      `,
      data(){
        return {
          msg: '组件内部数据'
        }
      },
      methods: {
        changeMsg(){
          this.msg = '值改变了';
        }
      },
      components: {
        Logo
      }
    };
    Vue.component('CommonHead', CommonHead)
    const vm = new Vue({
      el: '#app'
    })
  </script>
</body>
</html>